package com.example.shixunandjavagotoyangchen.BoosYang.Day001.Day00103;

import android.graphics.Paint;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.shixunandjavagotoyangchen.R;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * 作者:二徒
 * 时间：2021/10/28- 11:45
 * 功能实现：
 */
public class TeenagerDay00103Adpter extends BaseMultiItemQuickAdapter<TeenagerDay00103Bean.DataBean, BaseViewHolder> {

    public TeenagerDay00103Adpter(@Nullable List<TeenagerDay00103Bean.DataBean> data) {
        super(data);
        addItemType(1, R.layout.meizhuangday1);
        addItemType(2, R.layout.meizhuangday2);
        addItemType(3, R.layout.meizhuangday3);
        addItemType(4, R.layout.meizhuangday4);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, TeenagerDay00103Bean.DataBean dataBean) {
        switch (dataBean.getItemType()){
            case 1:
                Glide.with(getContext()).load(dataBean.getVideomainimg())
                        .error(R.mipmap.splash)
                        .into((ImageView) baseViewHolder.getView(R.id.meizhuangday1_img));
                baseViewHolder.setText(R.id.meizhuangday1_text1,""+dataBean.getCaption());
                baseViewHolder.setText(R.id.meizhuangday1_text2,"¥ "+dataBean.getView_count()+"  ");
                break;

            case 2:
                Glide.with(getContext()).load(dataBean.getVideomainimg())
                        .error(R.mipmap.splash)
                        .into((ImageView) baseViewHolder.getView(R.id.meizhuangday2_img));
                baseViewHolder.setText(R.id.meizhuangday2_text1,""+dataBean.getCaption());//标题
                baseViewHolder.setText(R.id.meizhuangday2_text2,"¥ "+dataBean.getLike_count()+" ");//打折
                baseViewHolder.setText(R.id.meizhuangday2_text3,"¥"+dataBean.getView_count()+" ");//原价
                TextView textView = baseViewHolder.getView(R.id.meizhuangday2_text3);
                textView.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
                break;

            case 3:
                Glide.with(getContext()).load(dataBean.getVideomainimg())
                        .error(R.mipmap.splash)
                        .into((ImageView) baseViewHolder.getView(R.id.meizhuangday3_img));
                baseViewHolder.setText(R.id.meizhuangday3_text1,""+dataBean.getCaption());//标题
                baseViewHolder.setText(R.id.meizhuangday3_text2,"¥ "+dataBean.getLike_count()+" ");//打折
                TextView view = baseViewHolder.getView(R.id.meizhuangday3_text3);
                view.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
                baseViewHolder.setText(R.id.meizhuangday3_text3,"¥"+dataBean.getView_count());//原价
                break;


            case 4:
                Glide.with(getContext()).load(dataBean.getVideomainimg())
                        .error(R.mipmap.splash)
                        .into((ImageView) baseViewHolder.getView(R.id.meizhuangday4_img));
                baseViewHolder.setText(R.id.meizhuangday4_text1,""+dataBean.getCaption());//标题
                baseViewHolder.setText(R.id.meizhuangday4_text2,"¥"+dataBean.getView_count());//原价
                break;
        }
    }
}
